package com.jwell.panprovider.ui.activity

import android.content.Intent
import android.os.Bundle
import android.support.v4.app.Fragment
import android.view.View
import com.jwell.driverapp.ui.base.BaseActivity
import com.jwell.panprovider.R
import com.jwell.panprovider.ui.adapter.ViewpagerAdapter
import com.jwell.panprovider.ui.fragment.transportplaneinfo.TransportPlaneInfoFragment
import com.jwell.panprovider.ui.fragment.transportplaneinfo.WaybillFragment
import kotlinx.android.synthetic.main.activity_transport_plan_info.*
import kotlinx.android.synthetic.main.toolbar.*

/**
 * 供应详情
 * @author 765773123
 * 2018/4/21
 */
class TransportPlanInfoActivity : BaseActivity() {
    private val tabTitles = mutableListOf("计划信息", "运单列表")
    private val fragments = mutableListOf<Fragment>(
            TransportPlaneInfoFragment(),
            WaybillFragment())

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_transport_plan_info)
        initToolBar("供应详情", true, null)
        viewPager.offscreenPageLimit = 2
        viewPager.adapter = ViewpagerAdapter(fm = supportFragmentManager, fragmentList = fragments, tabTitles = tabTitles)
        tablayout.setupWithViewPager(viewPager)
        toolbar_right_image_serarh.visibility = View.VISIBLE
        //搜索运输计划
        toolbar_right_image_serarh.setOnClickListener {
            var intent1 = Intent(this, WaybillSearchActivity::class.java)
            intent1.putExtra("id", intent?.getIntExtra("id", 0))
            startActivity(intent1)
        }
    }
}
